﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager.Master" AutoEventWireup="true" CodeBehind="round.aspx.cs" Inherits="Bus_proj.website.round" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../Styles/Stylebuttoncss.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/textbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
    function divexpandcollapse(divname) {
        var div = document.getElementById(divname);
        var img = document.getElementById('img' + divname);
        if (div.style.display == "none") {
            div.style.display = "inline";
            img.src = "../Images/minus.gif";
        } else {
            div.style.display = "none";
            img.src = "../Images/plus.gif";
        }
    }   
</script>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 460px;
        }
        .style4
        {
            width: 172px;
            height: 21px;
        }
        .style5
        {
            height: 21px;
        }
        .BG
        {
            width:500px;
            padding:10px;
            border:3px solid #dedede;
            background:#2F4F4F;
            filter:alpha(opacity=40); 
            opacity:0.4; 
        }
        .panal
        {
            border-radius:5px;
            -khtml-border-radius:5px;
            -moz-border-radius:5px;
            padding:10px;
            background:#F5FFFA;
        }
        .style6
        {
            width: 312px;
        }
        .style7
        {
            width: 172px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
    </Triggers>
    
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    BackgroundCssClass="BG"
    PopupControlID="Panel1"
    TargetControlID="LinkButton1"
    CancelControlID="Button3"
    >
    </asp:ModalPopupExtender>
    <%--<asp:Panel ID="Panel_popup" runat="server" CssClass="panal">
        <asp:Label ID="Label_show" runat="server" Text="Label"></asp:Label>
        <asp:TextBox ID="TextBox_show" runat="server"></asp:TextBox>
        <asp:Button ID="Button_ok" runat="server" Text="ok" />
        <asp:Button ID="Button_cancel" runat="server" Text="cancel" />
    </asp:Panel>  --%>   
       <asp:Panel ID="Panel2" runat="server">
<fieldset class="el02">
<legend>เพิ่มสายการเดินทาง</legend>
    <table class="style1">
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label1" runat="server" Text="หมายเลขเส้นทาง :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server" Width="150px" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label2" runat="server" Text="ชื่อต้นทาง :"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="DropDownList1" runat="server" Width="150px" 
                    DataSourceID="LinqDataSource1" DataTextField="ProvinceName" 
                    DataValueField="ProvinceName" CssClass="textbox">
                    <asp:ListItem Selected="True" Value="0">*เลือกต้นทาง</asp:ListItem>
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="Bus_proj.DataClasses1DataContext" EntityTypeName="" 
                    Select="new (ProvinceId, ProvinceName)" TableName="Provinces">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label3" runat="server" Text="ชื่อปลายทาง :"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="DropDownList2" runat="server" Width="150px" 
                    DataSourceID="LinqDataSource1" DataTextField="ProvinceName" 
                    DataValueField="ProvinceName" CssClass="textbox">
                    <asp:ListItem Selected="True" Value="0">*เลือกปลายทาง</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label11" runat="server" Text="อัตราค่าโดยสาร :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox7" runat="server" CssClass="textbox"></asp:TextBox>
                <asp:Label ID="Label15" runat="server" Text="บาท"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label12" runat="server" Text="ค่าธรรมเนียม  :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox8" runat="server" CssClass="textbox"></asp:TextBox>
                <asp:Label ID="Label16" runat="server" Text="บาท"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label4" runat="server" Text="ระยะทาง :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" CssClass="textbox"></asp:TextBox>
                <asp:Label ID="Label5" runat="server" Text="กิโลเมตร"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                <asp:Label ID="Label17" runat="server" Text="ชานชลา :"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox9" runat="server" CssClass="textbox"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" Height="34px" Text="เพิ่มข้อมูล" 
                    Width="124px" onclick="Button1_Click" CssClass="classname" />
               
            </td>
        </tr>
    </table>
</fieldset>
    </asp:Panel>


<asp:Panel ID="Panel1" runat="server" CssClass="panal" Width="541px" style="display:none">
<fieldset class="el02">
<legend>ข้อมูลจุดจอด</legend>
<table class="style1">
    <tr>
        <td class="style4" align="right">
            <asp:Label ID="Label6" runat="server" Text="ชื่อจุดจอด"></asp:Label>
            </td>
        <td class="style5">
            <asp:TextBox ID="TextBox3" runat="server" Width="150px" CssClass="textbox"></asp:TextBox>
            </td>
    </tr>
    <tr>
        <td class="style7" align="right">
            <asp:Label ID="Label7" runat="server" Text="อัตราค่าโดยสาร"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox4" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:Label ID="Label13" runat="server" Text="บาท"></asp:Label>
        </td>
    </tr>
    <tr>
        <td align="right" class="style7">
            <asp:Label ID="Label10" runat="server" Text="ค่าธรรมเนียม"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox6" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:Label ID="Label14" runat="server" Text="บาท"></asp:Label>
        </td>
    </tr>
    <tr>
        <td class="style7" align="right">
            <asp:Label ID="Label8" runat="server" Text="ระยะทาง"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox5" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:Label ID="Label9" runat="server" Text="กิโลเมตร"></asp:Label>
        </td>
    </tr>
    <tr>
        <td class="style7" align="right">
            &nbsp;</td>
        <td>
            <asp:Button ID="Button2" runat="server" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" Height="33px" Text="เพิ่มข้อมูล" 
                Width="131px" onclick="Button2_Click1" CssClass="classname" />
            <asp:Button ID="Button3" runat="server" Height="33px" onclick="Button3_Click" 
                Text="ยกเลิก" Width="110px" CssClass="classname" />
        </td>
    </tr>
</table>
</fieldset>
</asp:Panel>

<fieldset class="el03">
<legend>แสดงข้อมูลเส้นทางทั้งหมด</legend>
<table class="style1">
        <tr>
            <td align="center">
            <asp:LinkButton ID="LinkButton1" runat="server" style="display:none"/>
                <asp:GridView ID="gvEmployeeDetails" runat="server" AutoGenerateColumns="False" 
                ShowFooter="True" Width="681px"
             OnRowDataBound="gvEmployeeDetails_OnRowDataBound" 
                onrowcommand="gvEmployeeDetails_RowCommand" Font-Size="Medium">
            <Columns>
                <asp:TemplateField ItemStyle-Width="20px">
                    <ItemTemplate>
                        <a href="JavaScript:divexpandcollapse('div<%# Eval("Route_id") %>');">
                            <img id="imgdiv<%# Eval("Route_id") %>" width="9px" border="0" src="../Images/plus.gif"
                                alt="" /></a>                        
                    </ItemTemplate>
                    <ItemStyle Width="20px" VerticalAlign="Middle"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="หมายเลขเส้นทาง">
                <ItemTemplate>
                 <asp:Label ID="lblEmpID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Route_id") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>                
                <asp:BoundField DataField="Route_source" HeaderText="ชื่อต้นทาง" />
                <asp:BoundField DataField="Route_destination" HeaderText="ชื่อปลายทาง" />
                <asp:BoundField DataField="Route_distance" HeaderText="ระยะทางรวม" />                
                <asp:TemplateField HeaderText="เพื่มจุดจอด">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" OnClientClick="return confirm('ยืนยันการเพิ่มรายการ')" CommandName="cmdY" CommandArgument='<%#Eval("Route_id") %>' runat="server">เพิ่ม</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <tr>
                            <td colspan="100%">
                             <div id="div<%# Eval("Route_id") %>"  style="overflow:auto; display:none; position: relative; left: 15px; overflow: auto">
                                <asp:GridView ID="gv_Child" runat="server" Width="95%" AutoGenerateColumns="false" DataKeyNames="Route_id">
                                <Columns>
                                <asp:BoundField DataField="Point_name" HeaderText="ชื่อจุดจอด"/>
                                <asp:BoundField DataField="Point_charges" HeaderText="อัตราค่าโดยสาร"/>
                                <asp:BoundField DataField="Point_tax" HeaderText="ค่าธรรมเนียม"/>
                                <asp:BoundField DataField="Point_distance" HeaderText="ระยะทาง"/>                                
                                <asp:TemplateField HeaderText="ลบจุดจอด">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" OnClientClick="return confirm('ยืนยันการลบรายการ')" CommandName="cmdN" CommandArgument='<%#Eval("Point_id") %>' runat="server">ลบ</asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>                                
                                </Columns>
                                <HeaderStyle BackColor="#4D92C1" ForeColor="White" />
                                </asp:GridView>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#0063A6" ForeColor="White" />
        </asp:GridView>        
            </td>
        </tr>
        </table>
</fieldset>
    </ContentTemplate>
    </asp:UpdatePanel>

 
&nbsp;
</asp:Content>
